<%@ Page Language="C#" MasterPageFile="~/Employee.master" AutoEventWireup="true" CodeFile="ViewCustomers.aspx.cs" Inherits="Pages_Employee_ManageCustomers_ViewCustomers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="View Customers" CssClass="header"></asp:Label><br />
    <br />
    <br />
    <table>
        <tr>
            <td>Search Customer:</td>
            <td>
                <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
                <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
                <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="ID must be a positive integer" ControlToValidate="txtSearch" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <asp:RadioButton ID="rdCustomerID" runat="server" Checked="True" GroupName="GroupSearch" Text="ID" />&nbsp&nbsp
                <asp:RadioButton ID="rdFullName" runat="server" GroupName="GroupSearch" Text="Full Name" />
            </td>
        </tr>
    </table>
    <br />
    <asp:Label ID="lblMessage" runat="server"/>
    <br />
    <br />
    <asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="False" HeaderStyle-CssClass="smallheader" HeaderStyle-BackColor="#a9c0f2" BorderColor="#556CB0" GridLines="Vertical" Width="560px" AllowPaging="True" OnPageIndexChanging="gvCustomers_PageIndexChanging" DataSourceID="customersDataSource">
        <HeaderStyle HorizontalAlign="Center" BackColor="#A9C0F2" CssClass="smallheader" />
        <AlternatingRowStyle BackColor="Gainsboro" />
        <Columns>
            <asp:BoundField DataField="CustomerID" HeaderText="ID" SortExpression="CustomerID" />
            <asp:BoundField DataField="ContactNumber" HeaderText="Contact No." SortExpression="ContactNumber" />
            <asp:BoundField DataField="FullName" HeaderText="FullName" SortExpression="FullName" />            
            <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:BoundField DataField="PhoneNumber" HeaderText="Phone" SortExpression="PhoneNumber" />
            <asp:HyperLinkField DataNavigateUrlFields="CustomerID" DataNavigateUrlFormatString="~/Pages_Employee/ManageCustomers/EditCustomer.aspx?id={0}"
                HeaderText="Edit" Text="Edit" />
            <asp:TemplateField HeaderText="Select">
                <ItemTemplate>
                    <asp:CheckBox ID="cboDelete" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <RowStyle HorizontalAlign="Center" />
    </asp:GridView>
    <asp:ObjectDataSource ID="customersDataSource" runat="server" SelectMethod="GetCustomers"
        TypeName="DALCustomers" OldValuesParameterFormatString="original_{0}">
    </asp:ObjectDataSource>
    <br />
    <asp:Button ID="btnAddCustomer" runat="server" Text="Add new customer" OnClick="btnAddCustomer_Click"/>&nbsp;
    <asp:Button ID="btnDeleteCustomers" runat="server" Text="Delete selected customers" OnClick="btnDeleteCustomers_Click" CausesValidation="False" OnClientClick="return confirm('Are you sure you want to delete selected item(s) ?')" />
</asp:Content>
